package et.six.eta.View;

import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;

import com.avos.avoscloud.AVCloudQueryResult;
import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVQuery;
import com.avos.avoscloud.CloudQueryCallback;

import java.util.ArrayList;
import java.util.List;

import et.six.eta.R;
import et.six.eta.Util.app.BaseActivity;
import et.six.eta.Util.register.DensityUtils;

public class RegisterActivity extends BaseActivity {
    private RelativeLayout rl_title;
    private ImageView iv_menu;
    private ImageView iv_me;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_register;
    }

    @Override
    protected void initView() {
        rl_title = findViewById(R.id.rl_title);
        iv_menu = findViewById(R.id.iv_menu);
        iv_me = findViewById(R.id.iv_me);
        rl_title.post(new Runnable() {
            @Override
            public void run() {
                startAni();
            }
        });
    }

    private void startAni() {
        ValueAnimator valueAnimator = ValueAnimator.ofInt(rl_title.getHeight(), DensityUtils.dp2px(this, 50));
        valueAnimator.setInterpolator(new AccelerateInterpolator());

        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                rl_title.getLayoutParams().height = (int) animation.getAnimatedValue();
                rl_title.requestLayout();
            }
        });

        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(valueAnimator,
                ObjectAnimator.ofFloat(iv_me, "Alpha", 0.1f, 1.0f),
                ObjectAnimator.ofFloat(iv_menu, "Alpha", 0.1f, 1.0f));
        animatorSet.setDuration(1200);
        animatorSet.start();
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initListener() {

    }

}
